package com.yzh.croom.repository;

import com.yzh.croom.model.domain.Message;
import com.yzh.croom.model.domain.VRoom;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface MessageRepository extends JpaRepository<Message,Integer> {
    @Query("select m from tb_message m where m.status = 0 order by m.date desc ")
    public List<Message> getUnReadMessage();

    @Query("select m from tb_message m where m.status = 1 order by m.date desc ")
    public List<Message> getIsReadMessage();

    @Query("update tb_message t set t.status = 1 where t.id=?1 ")
    public int updateById(int id);

    public List<Message> getMessageByAccountAndStatus(String account,int status);

}
